package com.dangf.hzapp.activity;

import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.dangf.hzapp.Config;
import com.dangf.hzapp.R;

/**
 * 启动界面
 * @author 韦海生
 * @date 2014年7月31日
 */
public class StartActivity extends BaseActivity {
	private Button login_button;
	public static StartActivity startActivity = null;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        
        startActivity = this;
        
        ActionBar actionBar = getActionBar();
        actionBar.hide();
        
        if(!"".equals(Config.getCacheToken(this).getToken())){
        	Intent i = new Intent(StartActivity.this, MainActivity.class);
			startActivity(i);
			finish();
        }else{
	        login_button = (Button) findViewById(R.id.login_button);
	        login_button.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					Intent i = new Intent(StartActivity.this, LoginActivity.class);
					i.putExtra("start", true);
					startActivity(i);
				}
			});
        }
    }

	@Override
	protected String getActivityName() {
		return "启动画面";
	}
}
